<?php 
require_once('vendor/autoload.php');

use Endroid\QrCode\QrCode;

$cont = isset($_GET['cont']) ? urldecode($_GET['cont']) : 'https://www.helloweba.com';

try {
    $qrCode = new QrCode($cont);
    $qrCode
        ->setSize(200)
        ->setEncoding('UTF-8')
        ->setLabel('手机扫一扫', 12)
        ->setLogoPath('logo.png')
        ->setLogoWidth(64)
        ->setValidateResult(false)
        ;

    header('Content-Type: '.$qrCode->getContentType());
    echo $qrCode->writeString();
} catch (Exception $e) {
    echo $e->getMessage(); 
}
